// components/match-list/index.js
import { dataProcessing } from '../../utils/matchChange.js'
import { removeObj } from '../../utils/removeObj.js'
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list: {
      type: Array,
      value: [],
      observer(newVal, oldVal) {
        if (newVal.length != oldVal.length) {
          this.triggerEvent('changeData', removeObj(newVal, ['ableCoupon', 'ableIntegral', 'address', 'categoryId', 'categoryName', 'cityId', 'countryId', 'couponList', 'createBy', 'createTime', 'deleted', 'image', 'isOnline', 'isRecommend', 'matchFormList', 'matchSkuList', 'navList', 'params', 'progress', 'provinceId', 'qrCode', 'recommendIds', 'remark', 'scheduleId', 'searchValue', 'showTimeStart', 'status', 'sysId', 'time', 'updateBy', 'updateTime']))
        }
      }
    },
    isRequst: {
      type: Boolean,
      value: false
    },
    showToastState: {
      type: Boolean, 
      value: false
    },
    paddingTop:{
      type:String,
      value:'0'
    },
    total: {
      type: String,
      value: '0'
    },
    hiddenTotal: {
      type: Boolean,
      value: false
    },
    noDataHeight:{
      type:String,
      value:'100vh'
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    toDetail(e) {
      let { index, id } = e.currentTarget.dataset
      let { images, matchName } = this.data.list[index]
      wx.navigateTo({ url: `/pages/competition_detail/index?id=${id}&images=${encodeURIComponent(JSON.stringify(images))}&matchName=${matchName}` })
    }
  },
  lifetimes: {
    // attached: function () {
    // }
  }
})
